home *** CD-ROM | disk | FTP | other *** search
- Path: engnews1.Eng.Sun.COM!taumet!clamage
- From: solution@gate.net (Ken Walter)
- Newsgroups: comp.std.c++
- Subject: Re: Observations on templates
- Date: 7 Feb 1996 15:57:08 GMT
- Organization: Solution Technology
- Approved: clamage@eng.sun.com (comp.std.c++)
- Message-ID: <4fa6d0$115g@news.gate.net>
- References: <ACVI83na99@qsar.chem.msu.su>
- NNTP-Posting-Host: taumet.eng.sun.com
- Content-Type: text
- X-Nntp-Posting-Host: dfbfl2-21.gate.net
- X-Newsreader: NeoLogic News for OS/2 [version: 4.2]
- Content-Length: 835
- X-Lines: 28
- Originator: clamage@taumet
-
- In message <3114137D.CFC@suphys.physics.su.oz.au> - John Max Skaller <maxtal@su
- phys.physics.su.oz.au> writes:
- :>
- :>Eugene Radchenko wrote:
- :>> Why don't use, for instance, cast_d instead od
- :>> dynamic_cast (ugh).
- :>
- :> This is quite deliberate. Bjarne dislikes casts. So do I.
- :>He didn't invent new style casts (and RTTI) for your convenience,
- :>he invented them to make sure no one else did. Long names were deliberately
- :>chosen to discourage use of casts.
- :>
- But dynamic casts are almost required to do anything.
-
- I always thought the following was interesting:
-
- template <class T, class S> T cast_d( S s) { return dynamic_cast<T>s; }
-
- and the expression:
-
- cast_d<T>(s)
-
- Casts could almost be implemented without being part of the language.
-
- Ken Walter
-
- * All the above is hearsay and the opinion of nobody in particular
-
-
- [ comp.std.c++ is moderated. Submission address: std-c++@ncar.ucar.edu.
- Contact address: std-c++-request@ncar.ucar.edu. The moderation policy is
- summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
- ]
-